package cn.t.service.device;

import cn.t.core.service.ServiceImpl;
import cn.t.enums.OptionTypeEnum;
import cn.t.model.device.DeviceDataDO;
import cn.t.repository.device.DeviceDataRepository;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 设备盘点数据表(DeviceData)领域服务
 *
 * @author t
 * @since 2024-05-24 10:19:11
 */
@Slf4j
@Service
@AllArgsConstructor
public class DeviceDataService extends ServiceImpl<DeviceDataDO, DeviceDataRepository> {
    public List<DeviceDataDO> queryDeviceDataByTime(Date startDate, Date endDate,Long deviceId, OptionTypeEnum optionTypeEnum) {
        DeviceDataDO deviceDataDO = new DeviceDataDO();
        deviceDataDO.setGmtCreatedStart(startDate);
        deviceDataDO.setGmtCreatedEnd(endDate);
        deviceDataDO.setDeviceId(deviceId);
        deviceDataDO.setBusinessType(optionTypeEnum.getCode());
        return repository.queryDeviceDataByTime(deviceDataDO);
    }
}
